home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3086 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.2 KB

  1. Path: news.ssnet.com!not-for-mail
  2. From: helie@ssnet.com (Ray Helie)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Virtual Members: Difficult Question
  5. Date: 22 Jan 1996 00:40:01 -0500
  6. Organization: SSNet, Inc.
  7. Message-ID: <4dv7vh$2as@marlin.ssnet.com>
  8. References: <4dmha6$80c@marlin.ssnet.com> <4dpbv2$l6k@colossus.holonet.net>
  9. NNTP-Posting-Host: marlin.ssnet.com
  10.  
  11. Russell Blackadar <russell@news.mdli.com> wrote:
  12.  
  13. - : void func1 (CObject* pItem)
  14. - :     {
  15. - :     C_BASE* base;
  16. - :     base = pItem;
  17. -         ????????????  ILLEGAL
  18. - You should get a compile error on this stmt.  No automatic
  19. - conversion exists from a base pointer to a derived pointer.
  20.  
  21. Actually, you're right-- I do cast in my progam but left it
  22. out of my posting in haste..
  23.  
  24.  
  25. - : On to the difficult part:
  26. - [...]
  27. - : I'm reading and writing object states to disk...
  28. - Oh boy, I smell trouble.  Are you expecting to use objects
  29. - saved from a previous run, for example?  The vtbl pointers
  30. - (and any other pointers) will be all wrong.  This is the
  31. - classic problem of "persistent objects" which requires a
  32. - very careful solution.
  33.  
  34. Do you (or anyone) know of any such safe solution?
  35.  
  36.  
  37. Thank you for the insights.
  38.  
  39. Ray [helie@ssnet.com]
  40.  
  41.